import 'package:flutter/material.dart';

class MyApp18 extends StatelessWidget {
  const MyApp18({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('GridView的基本使用'),
        backgroundColor: const Color.fromARGB(255, 232, 221, 10),
      ),
      body: GridView(
        gridDelegate:
        // 固定大小
        SliverGridDelegateWithMaxCrossAxisExtent(maxCrossAxisExtent: 200),
        children: [
          Container(color: Colors.amber, child: Text('1')),
          Container(color: Colors.black, child: Text('1')),
          Container(color: Colors.blue, child: Text('1')),
          Container(color: Colors.blueGrey, child: Text('1')),
          Container(color: Colors.brown, child: Text('1')),
          Container(color: Colors.cyan, child: Text('1')),
          Container(color: Colors.cyanAccent, child: Text('1')),
        ],
      ),
    );
  }
}
